<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.js"></script>
</head>
<body>
        
    <!-- <form method="post" id="avatar" enctype="multipart/form-data">
        <input type="file" id="fiileName">
        <input type="button" id="setting_submit_avatar" value="上传">
    </form> -->
    <form action="test/upfile" method="post" enctype="multipart/form-data">
            <input type="file" name="file">
            <input type="submit"value="上传">
    </form>
<script>
    $('#setting_submit_avatar').click(function() {
        $.ajax({
            url: 'test/upfile',
            type: 'post',
            data: $('#avatar').serialize(),
            fileELementId: 'fileName',
            success: function(body) {
                location.href='upfile.html';
            }
        });
    });
</script>    
</body>
</html>